package com.jtpay.sdk.adapter;

import android.view.LayoutInflater;
import android.view.View;

import com.jtpay.sdk.holder.BaseViewHolder;
import com.jtpay.sdk.jtpay.model.PayChannelInfo;
import com.jtpay.sdk.view.ChoiceView;

import java.util.List;

/**
 * Created by Steven on 2016/6/21 0021.
 */

public class ChannelAdapter extends CommonAdapter<PayChannelInfo> {

    public ChannelAdapter(List<PayChannelInfo> list, int id) {
        super(list, id);
    }

    public ChannelAdapter(List<PayChannelInfo> list) {
        super(list);
    }

    @Override
    protected void onBindViewHolder(BaseViewHolder viewHolder, PayChannelInfo s, int position) {
        ChoiceView choiceView = (ChoiceView) viewHolder.getConvertView();
        choiceView.getTextView().setText((position + 1) + s.getChannelName());
    }


    @Override
    protected View createParentView(View view, int id) {
        LayoutInflater layoutInflater = LayoutInflater.from(view.getContext());
        if (0 != id) {
            return layoutInflater.inflate(id, null);
        } else {
            return new ChoiceView(view.getContext());
        }
    }
}
